package com.ptt.sqm.component;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
import android.widget.SlidingDrawer;

public class CustomSlidingDrawer extends SlidingDrawer {

	@SuppressWarnings("deprecation")
	public CustomSlidingDrawer(Context context, AttributeSet attrs,
			int defStyle) {
		super(context, attrs, defStyle);
	}

	public CustomSlidingDrawer(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	@SuppressWarnings("deprecation")
	@Override
	protected void onLayout(boolean changed, int l, int t, int r, int b) {
		super.onLayout(changed, l, t, r, b);

		final int height = b - t;

		ImageView handle = (ImageView) getHandle();
		int childLeft = 0;
		int childWidth = handle.getWidth();
		int topOffset = 0;
		int bottomOffest = 0;
		int childHeight = handle.getHeight();

		
		int childTop = this.isOpened() ? topOffset : height - childHeight
				+ bottomOffest;

		handle.layout(childLeft, childTop, childLeft + childWidth, childTop
				+ childHeight);
	}
	

}
